﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="GioHang.aspx.cs" Inherits="BookBuy.GioHang" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentTitle" runat="server">
    GIỎ HÀNG
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentDescription" runat="server">
    NHÀ SÁCH THỂ DỤC THỂ THAO
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div id="content">
    <%--<asp:Table ID="Table1" runat="server" BorderStyle="Solid">
         <asp:TableRow runat="server">
             <asp:TableCell runat="server">STT</asp:TableCell>
             <asp:TableCell runat="server">Tên sách</asp:TableCell>
             <asp:TableCell runat="server">Đơn giá</asp:TableCell>
             <asp:TableCell runat="server">Số lượng</asp:TableCell>
             <asp:TableCell runat="server">Thành tiền</asp:TableCell>
         </asp:TableRow>
     </asp:Table>--%>
    <h2>Giỏ hàng</h2>
    <table id="sanphamgiohang" border="1" style="border: thin solid #808080; width:100%">
        <tr align="center">
            <td>ID</td>
            <td>Mã sách</td>
            <td>Tên sách</td>
            <td>Đơn giá</td>
            <td>Số lượng</td>
            <td>Thành tiền</td>
            <td style="overflow:hidden;"></td>
        </tr>
        <% 
           List<BookBuy.CHITIETGIOHANG> CTGioHang = (List<BookBuy.CHITIETGIOHANG>)Cache["CTGioHang"];
           float tongtien = 0;
           for (int i = 0; i < CTGioHang.Count; i++)
           {
                BookBuy.SANPHAM sach =  data.GetSanPhams(CTGioHang[i].MASP);                 
        %>
                <tr align="center">
                    <td><%= i+1 %></td>
                    <td><%= sach.MASP %></td>
                    <td><%= sach.TENSP %></td>
                    <td><%= sach.GIABAN %></td>
                    <td>
                        <%= CTGioHang[i].SOLUONG %>
                        <%--<asp:TextBox ID="TextBox4" runat="server" Width="70px">sach.SOLUONG</asp:TextBox>--%>
                    </td>
                    <%
                        float thanhtien = CTGioHang[i].SOLUONG * float.Parse(sach.GIABAN);
                        tongtien += thanhtien;
                    %>
                    <td>
                        <%--<asp:Label ID="lb_thanhtien" runat="server" Text="....."><%= thanhtien %></asp:Label></td>--%>
                        <%= thanhtien %>
                    <td style="width: 120px;">
                        <asp:ImageButton ID="btn_update" runat="server" ImageUrl="~/images/update.png" 
                            style="margin-right: 20px;" onclick="btn_update_Click" />
                        <asp:ImageButton ID="btn_delete" runat="server" ImageUrl="~/images/delete.png" 
                            onclick="btn_delete_Click"  />
                    </td>
                </tr>
        <% } %>
        
    </table>

    <div id="tongtien" style="display:block; margin-top: 10px; overflow:hidden;">
        <span style=" display:block; float:right;">Tổng tiền :<%= tongtien %> VNĐ</span>        
    </div>

    <div id="vanchuyen" style="display:block; overflow:hidden;">
        <h2 >Vận chuyển</h2>
        <span>(Hãy chọn nhà vận chuyển để tính tiền vận chuyển)</span>
        <ul style="list-style:none; float:left; width:100%; text-align:center;margin-top: 20px; display:block;">
            <li><asp:ImageButton ID="btn_nhavanchuyen1" runat="server" 
                    ImageUrl="http://upstransport.somee.com/Content/Images/logo.jpg" 
                    onclick="btn_nhavanchuyen1_Click" ToolTip="Vận chuyển 09" /></li>
            <li><asp:ImageButton ID="btn_nhavanchuyen2" runat="server" 
                    onclick="btn_nhavanchuyen2_Click" 
                    ImageUrl="http://globaltranz.somee.com/Images/logo.gif" 
                    ValidationGroup="Vận chuyển 10" /></li>
        </ul>
    </div>
    <%--<asp:ImageButton ID="btn_thanhtoan"  runat="server" ImageUrl="~/images/btn_thanhtoan.png" style="float:right; margin-right: 20px;"/>--%>
 </div>
</asp:Content>
